Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust FaaS docs for layout = "zip" #19180

Merged
merged 7 commits into from
May 30, 2023

Conversation

huonw
Copy link
Contributor

@huonw huonw commented May 28, 2023

This adjusts the AWS Lambda and Google Cloud Function documentation for the new Zip layout, added in #19076 and targeted for 2.17.

This PR is just what's required for 2.17, ready to cherry-pick. The "Migrating" section is written with this in mind. It will require adjustment for 2.18 to reflect the change in defaults, and, hopefully, support for AWS Lambda Layers (#18880, #19123).

Fixes #19067

@huonw huonw marked this pull request as ready for review May 28, 2023 04:21
@huonw huonw requested a review from benjyw May 28, 2023 04:21
@huonw huonw force-pushed the feature/19067-layout-zip-docs branch from b954363 to 91ad8fd Compare May 28, 2023 11:21
Wrote code bundle to dist/project.zip
Runtime: python3.8
Handler: lambdex_handler.handler
$ pants package project/:lambda
Copy link
Contributor Author

@huonw huonw May 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from file path to proper target is a drive-by fix up to make the docs align with #18737, not related to/required by the layout change.

@huonw huonw force-pushed the feature/19067-layout-zip-docs branch from 91ad8fd to 5cd5142 Compare May 28, 2023 11:25
layout = "zip"
```

To temporarily continue using the old behaviour in Pants 2.17, instead set `layout = "lambdex"`. This will not be supported in Pants 2.19. If you encounter a bug with `layout = "zip"`, [please let us know](https://github.com/pantsbuild/pants/issues/new/choose).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, we could also document the ability to use a pex_binary as a Lambda artefact directly (e..g if a user needs the dynamic initialisation), with the __pex__. prefix on the handler. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't hurt! But it is an advanced topic, and should be introduced as such. "In the rare case where you need to X..."

Copy link
Contributor Author

@huonw huonw May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a dedicated section "Advanced: Using PEX directly" section, outside this one (but linked to it), because those docs seem like they'll be relevant even after this transition is ancient history.

layout = "zip"
```

To temporarily continue using the old behaviour in Pants 2.17, instead set `layout = "lambdex"`. This will not be supported in Pants 2.19. If you encounter a bug with `layout = "zip"`, [please let us know](https://github.com/pantsbuild/pants/issues/new/choose).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't hurt! But it is an advanced topic, and should be introduced as such. "In the rare case where you need to X..."

src/python/pants/backend/python/subsystems/lambdex.py Outdated Show resolved Hide resolved
You must specify the handler as `handler`.
You must specify the handler as `handler`. This is a re-export of the function referred to by the `handler` field of the target.

Advanced: Using PEX directly
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never used GCF, so this is purely 'from the books', especially the stuff about GOOGLE_FUNCTION_SOURCE. I don't know if it works as I've described, in practice. 🤷

@huonw huonw requested a review from benjyw May 30, 2023 06:29
@huonw
Copy link
Contributor Author

huonw commented May 30, 2023

Oops, forgot the typo fix from #19122 (comment). Added now. I also read through after a night's sleep and found a few other minor typos/poor phrasing, so fixed them.

@huonw huonw enabled auto-merge (squash) May 30, 2023 22:44
@huonw huonw merged commit 9089aea into pantsbuild:main May 30, 2023
@huonw huonw deleted the feature/19067-layout-zip-docs branch May 30, 2023 23:13
huonw added a commit to huonw/pants that referenced this pull request May 30, 2023
This adjusts the AWS Lambda and Google Cloud Function documentation for
the new Zip layout, added in pantsbuild#19076 and targeted for 2.17.

This PR is just what's required for 2.17, ready to cherry-pick. The
"Migrating" section is written with this in mind. It will require
adjustment for 2.18 to reflect the change in defaults, and, hopefully,
support for AWS Lambda Layers (pantsbuild#18880, pantsbuild#19123).

Fixes pantsbuild#19067
huonw added a commit that referenced this pull request May 31, 2023
This adjusts the AWS Lambda and Google Cloud Function documentation for
the new Zip layout, added in #19076 and targeted for 2.17.

This PR is just what's required for 2.17, ready to cherry-pick. The
"Migrating" section is written with this in mind. It will require
adjustment for 2.18 to reflect the change in defaults, and, hopefully,
support for AWS Lambda Layers (#18880, #19123).

Fixes #19067
huonw added a commit that referenced this pull request Aug 31, 2023
Small typo in #19180: the target name is `lambda`, and hence the PEX
name will be `lambda.pex`, not `lambdex.pex`.
WorkerPants pushed a commit that referenced this pull request Aug 31, 2023
Small typo in #19180: the target name is `lambda`, and hence the PEX
name will be `lambda.pex`, not `lambdex.pex`.
WorkerPants pushed a commit that referenced this pull request Aug 31, 2023
Small typo in #19180: the target name is `lambda`, and hence the PEX
name will be `lambda.pex`, not `lambdex.pex`.
huonw added a commit that referenced this pull request Aug 31, 2023
Small typo in #19180: the target name is `lambda`, and hence the PEX
name will be `lambda.pex`, not `lambdex.pex`.

Co-authored-by: Huon Wilson <huon@exoflare.io>
huonw added a commit that referenced this pull request Aug 31, 2023
Small typo in #19180: the target name is `lambda`, and hence the PEX
name will be `lambda.pex`, not `lambdex.pex`.

Co-authored-by: Huon Wilson <huon@exoflare.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update FaaS documentation for new layout="zip"
3 participants